<?php

namespace App\Http\Middleware;

use Illuminate\Auth\Middleware\Authenticate as Middleware;
use App\Exceptions\ApiException;

class Authenticate extends Middleware
{
    /**
     * @param \Illuminate\Http\Request $request
     * @return null|string|void
     * @throws ApiException
     */
    protected function redirectTo($request)
    {
        if (! $request->expectsJson()) {
            throw new ApiException('api_token验证失败',999);
        }
    }
}
